package com.ftg.learn.mapper;


import com.ftg.learn.domain.SysMenu;
import com.ftg.learn.domain.SysUserDomain;
import com.ftg.learn.util.MenuVo;
import com.ftg.learn.util.ToWeb;
import com.ftg.learn.vo.UserListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author kangjx
 * @date 2024/1/31
 */
@Mapper
public interface SysUserMapper {

    List<UserListVo> selectUserList(@Param("account") String account,@Param("phone") String phone, @Param("status") Integer status, @Param("start") Long start, @Param("pageSize") Long pageSize );

    long selectCount(@Param("account") String account,@Param("phone") String phone, @Param("status") Integer status);

    int insert(SysUserDomain domain);

    Object findByAccount(@Param("account") String account);

    Integer findUserIdByAccount(@Param("account") String account);

    void insertUserRole(@Param("userId") Integer userId, @Param("roleIds") Integer[] roleIds);

    int deleteById(@Param("id") Integer id);

    int deleteUserRoleByUserId(@Param("userId") Integer userId);

    SysUserDomain findone(@Param("userId") Integer userId);

    List<Integer> findRoleByUserid(@Param("userId") Integer userId);

    int updateUser(SysUserDomain domain);

    @Select("select id,name,job,phone,status from sys_user where account=#{account} and password=#{password}")
    SysUserDomain login(@Param("account") String account, @Param("password") String password);

    List<SysMenu> auth(@Param("userId") Integer userId);
}
